package cn.jiyun.goods.controller;

import cn.jiyun.goods.pojo.Goods;
import cn.jiyun.goods.pojo.dto.GoodsDto;
import cn.jiyun.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    @RequestMapping("/findAll")
    public List<Goods> findAll(){
        return goodsService.findAll();
    }
    @RequestMapping("/add")
    public String add(@RequestBody GoodsDto goodsDto){
        goodsService.add(goodsDto);
        return "添加成功";
    }
}
